package net.zz.vali.controller;

import net.zz.base.validate.ann.QQ;
import net.zz.vali.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.HashMap;
import java.util.Map;
/**
 * Created by ZaoSheng on 2015/5/9.
 */
@RestController
@RequestMapping("/")
public class HelloController {

    @Valid
	@RequestMapping(value = "aa", method = RequestMethod.GET)
	public Map printWelcome(String model1, @QQ String model) throws Exception{
        System.out.println(model);
        return successData();
	}

    @RequestMapping(value = "bb", method = RequestMethod.GET)
    public Map print(@Valid User model) throws Exception{
        System.out.println("______");
        return successData();
}
    @Valid
    @RequestMapping(value = "cc", method = RequestMethod.GET)
    public Map cc(@NotNull(message = "不能为空") String model) {
        System.out.println("______");
        return successData();
    }
    protected Map<String,Object> successData() {
        Map<String,Object> data = new HashMap<String, Object>();
        data.put("ZZCode", 0);
        return  data;
    }
}